(function homePagePullImplementation($) {
  "use strict";
    var listSelector = "#pageTopBookmarkList";

    function onPullUp (event, data) {      
        if (!($(document).data('loading')) && (ProductListLoader.prototype.curProdPage > -1) && (ProductListLoader.prototype.curQueryStr != null)) {
            $(document).data('loading', true);
            var iscrollview = data.iscrollview;
            setTimeout(function () {
                ProductListLoader.prototype.loadProducts($(listSelector), $(".home-pull"), function () {
                    iscrollview.refresh(); 
                }, null);
            }, 1500);
        }
    }    
  
  // Set-up jQuery event callbacks
    $(document).delegate("div#pageHome", "pageinit", function (event) {
        $(".iscroll-wrapper", this).bind( {
         iscroll_onpullup   : onPullUp
        } );
    } );
}(jQuery));

(function itemSearchPagePullImplementation($) {
  "use strict";
  
    function onPullUp (event, data) {     
        if (!($(document).data('loading')) && (SearchService.prototype.curPage > -1)) {
            $(document).data('loading', true);
            var listSelector = SearchService.prototype.searchPullShow ? "#schItemList" : "#schBookmarkList";            
            var iscrollview = data.iscrollview;
            setTimeout(function () {
                if (SearchService.prototype.searchPullShow) {
                    SearchService.prototype.showItemList(null, 0, loadedCallback(iscrollview));
                } else if (SearchService.prototype.bookmarkPullShow) {
                    ProductListLoader.prototype.loadProducts($(listSelector), $(".itemsearch-pull"), loadedCallback(iscrollview), Messages.prototype.BOOKMARK_NOT_FOUND);
                }
        }, 1500);
        }
    }
    
    function loadedCallback (iscrollview) {
        setTimeout(function () {
            iscrollview.refresh();
        }, 2500);
    }
  
  // Set-up jQuery event callbacks
    $(document).delegate("div#pageItemSearchResult", "pageinit", function (event) {
        $(".iscroll-wrapper", this).bind( {
            iscroll_onpullup   : onPullUp
        } );
    } );
}(jQuery));

(function cityArchivesPagePullImplementation($) {
  "use strict";
    var listSelector = "#prefBookmarkList";
        
    function onPullUp (event, data) {      
        if (!($(document).data('loading')) && (ProductListLoader.prototype.curProdPage > -1) && (ProductListLoader.prototype.curQueryStr != null)) {
            $(document).data('loading', true);
            var iscrollview = data.iscrollview;
            setTimeout(function () {
                ProductListLoader.prototype.loadProducts($(listSelector), $(".cityarchives-pull"), function () {
                    iscrollview.refresh(); 
                }, Messages.prototype.BOOKMARK_NOT_FOUND);
            }, 1500);
        }
    }
  
  // Set-up jQuery event callbacks
    $(document).delegate("div#pageCityArchives", "pageinit", function (event) {
        $(".iscroll-wrapper", this).bind( {
            iscroll_onpullup   : onPullUp
        } );
    } );
}(jQuery));

(function bookmarkListArchivesPagePullImplementation($) {
  "use strict";
    var listSelector = "#archiveBookmarkList";
  
    function onPullUp (event, data) {      
        if (!($(document).data('loading')) && (ProductListLoader.prototype.curProdPage > -1) && (ProductListLoader.prototype.curQueryStr != null)) {
            $(document).data('loading', true);
            var iscrollview = data.iscrollview;
            setTimeout(function () {
                ProductListLoader.prototype.loadProducts($(listSelector), $(".bookmarklistarchives-pull"), function () {
                    iscrollview.refresh(); 
                }, Messages.prototype.BOOKMARK_NOT_FOUND);
            }, 1500);
        }
    }
  
  // Set-up jQuery event callbacks
    $(document).delegate("div#pageBookmarkList", "pageinit", function (event) {
        $(".iscroll-wrapper", this).bind( {
            iscroll_onpullup   : onPullUp
        } );
    } );
}(jQuery));

(function ECsitePagePullImplementation($) {
  "use strict";
    var listSelector = "#listProductsView"; 
  
    function onPullUp (event, data) {      
        if (!($(document).data('loading')) && ECSiteController.prototype.tabs[ECSiteController.prototype.curTabIndex].pageNo > -1) {
            $(document).data('loading', true);
            var iscrollview = data.iscrollview;
            setTimeout(function () {
                ECSiteController.prototype.loadDataFromServer(function () {
                   iscrollview.refresh();
                });    
            }, 1500);
        }
    }
  
  // Set-up jQuery event callbacks
    $(document).delegate("div#pageECsite", "pageinit", function (event) {
        $(".iscroll-wrapper", this).bind( {
            iscroll_onpullup   : onPullUp
        } );
    } );
}(jQuery));
